Constants

BODY_MAX_SIZE

BODY_MAX_SIZE = 1048576

Properties

$uid

$uid

$folder

$folder

$headers

$headers

$sender

$sender

$context

$context

$body

$body

$parts

$parts

$mime_parts

$mime_parts

$inline_parts

$inline_parts

$attachments

$attachments

$subject

$subject

$is_safe

$is_safe

$pgp_mime

$pgp_mime

$encrypted_part

$encrypted_part

$app

$app : \rcube

Instance of framework class.

Type

rcube

$storage

$storage : \rcube_storage

Instance of storage class

Type

rcube_storage

$mime

$mime : \rcube_mime

Instance of mime class

Type

rcube_mime

$opt

$opt

$parse_alternative

$parse_alternative

$got_html_part

$got_html_part

$tnef_decode

$tnef_decode

Methods

__construct()

__construct(string  $uid, string  $folder = null, bool  $is_safe = false) : mixed

__construct

Provide a uid, and parse message structure.

Parameters

string $uid

The message UID.

string $folder

Folder name

bool $is_safe

Security flag

Returns

mixed —

get_header()

get_header(string  $name, bool  $raw = false) : string

Return a (decoded) message header

Parameters

string $name

Header name

bool $raw

Don't mime-decode the value

Returns

string —

Header value

set_safe()

set_safe(bool  $safe = true) : mixed

Set is_safe var and session data

Parameters

bool $safe

enable/disable

Returns

mixed —

get_part_url()

get_part_url(string  $mime_id, mixed  $embed = false) : string|false

Compose a valid URL for getting a message part

Parameters

string $mime_id

Part MIME-ID

mixed $embed

Mimetype class for parts to be embedded

Returns

string|false —

URL or false if part does not exist

get_part_content()

get_part_content(string  $mime_id, resource  $fp = null, bool  $skip_charset_conv = false, int  $max_bytes, bool  $formatted = true) : string

Get content of a specific part of this message

Parameters

string $mime_id

Part MIME-ID

resource $fp

File pointer to save the message part

bool $skip_charset_conv

Disables charset conversion

int $max_bytes

Only read this number of bytes

bool $formatted

Enables formatting of text/* parts bodies

Returns

string —

Part content

get_part_body()

get_part_body(string  $mime_id, bool  $formatted = false, int  $max_bytes, mixed  $mode = null) : string|bool

Get content of a specific part of this message

Parameters

string $mime_id

Part ID

bool $formatted

Enables formatting of text/* parts bodies

int $max_bytes

Only return/read this number of bytes

mixed $mode

NULL to return a string, -1 to print body or file pointer to save the body into

Returns

string|bool —

Part content or operation status

format_part_body()

format_part_body(string  $body, \rcube_message_part  $part, string  $default_charset = null) : string

Format text message part for display

Parameters

string $body

Part body

\rcube_message_part $part

Part object

string $default_charset

Fallback charset if part charset is not specified

Returns

string —

Formatted body

has_html_part()

has_html_part(bool  $enriched = false, \rcube_message_part  $part = null) : bool

Determine if the message contains a HTML part. This must to be a real part not an attachment (or its part)

Parameters

bool $enriched

Enables checking for text/enriched parts too

\rcube_message_part $part

Reference to the part if found

Returns

bool —

True if a HTML is available, False if not

has_text_part()

has_text_part(\rcube_message_part  $part = null) : bool

Determine if the message contains a text/plain part. This must to be a real part not an attachment (or its part)

Parameters

\rcube_message_part $part

Reference to the part if found

Returns

bool —

True if a plain text part is available, False if not

first_html_part()

first_html_part(\rcube_message_part  $part = null, bool  $enriched = false) : string|null

Return the first HTML part of this message

Parameters

\rcube_message_part $part

Reference to the part if found

bool $enriched

Enables checking for text/enriched parts too

Returns

string|null —

HTML message part content

first_text_part()

first_text_part(\rcube_message_part  $part = null, bool  $strict = false) : string|null

Return the first text part of this message.

If there's no text/plain part but $strict=true and text/html part exists, it will be returned in text/plain format.

Parameters

\rcube_message_part $part

Reference to the part if found

bool $strict

Check only text/plain parts

Returns

string|null —

Plain text message/part content

mime_parts()

mime_parts() : mixed

Return message parts in current context

Returns

mixed —

is_attachment()

is_attachment(\rcube_message_part  $part) : bool

Checks if part of the message is an attachment (or part of it)

Parameters

\rcube_message_part $part

Message part

Returns

bool —

True if the part is an attachment part

get_multipart_encrypted_part()

get_multipart_encrypted_part() : \rcube_message_part

In a multipart/encrypted encrypted message, find the encrypted message payload part.

Returns

\rcube_message_part —

tnef_decode()

tnef_decode(\rcube_message_part  $part) : \rcube_message_part[]

Decode a Microsoft Outlook TNEF part (winmail.dat)

Parameters

\rcube_message_part $part

Message part to decode

Returns

\rcube_message_part[] —

List of message parts extracted from TNEF

uu_decode()

uu_decode(\rcube_message_part  $part) : \rcube_message_part[]

Parse message body for UUencoded attachments bodies

Parameters

\rcube_message_part $part

Message part to decode

Returns

\rcube_message_part[] —

List of message parts extracted from the file

unfold_flowed()

unfold_flowed(mixed  $text) : mixed

Deprecated methods (to be removed)

Parameters

mixed $text

Returns

mixed —

format_flowed()

format_flowed(mixed  $text, mixed  $length = 72) : mixed

Parameters

mixed $text
mixed $length

Returns

mixed —

fix_attachment_name()

fix_attachment_name(string  $name, \rcube_message_part  $part) : string

Fix attachment name encoding if needed and possible

Parameters

string $name

Attachment name

\rcube_message_part $part

Message part

Returns

string —

Fixed attachment name

parse_structure()

parse_structure(\rcube_message_part  $structure, bool  $recursive = false) : mixed

Read the message structure returned by the IMAP server and build flat lists of content parts and attachments

Parameters

\rcube_message_part $structure

Message structure node

bool $recursive

True when called recursively

Returns

mixed —

get_mime_numbers()

get_mime_numbers(\rcube_message_part  $part) : mixed

Fill a flat array with references to all parts, indexed by part numbers

Parameters

\rcube_message_part $part

Message body structure

Returns

mixed —

add_part()

add_part(\rcube_message_part  $part, string  $type = null) : mixed

Add a part to object parts array(s) (with context check)

Parameters

\rcube_message_part $part

Message part

string $type

Part type (inline/attachment)

Returns

mixed —

check_context()

check_context(\rcube_message_part  $part) : bool

Check if specified part belongs to the current context

Parameters

\rcube_message_part $part

Message part

Returns

bool —

True if the part belongs to the current context, False otherwise